# 获取页面对页面进行操作

from appium import webdriver as appdriver
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

from config import DES, APPURL


class GetDriver():
    __web_driver = None
    __app_driver = None

    @classmethod
    def get_web_driver(cls):
        if cls.__web_driver is None:
            cls.options = Options()
            cls.options.page_load_strategy = 'eager'
            cls.__web_driver = webdriver.Chrome(options=cls.options)
            cls.__web_driver.maximize_window()
        return cls.__web_driver

    @classmethod
    def get_app_driver(cls):
        if cls.__app_driver is None:
            cls.__app_driver = appdriver.Remote(APPURL, DES)
        return cls.__app_driver